<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Administration/main.master"
    CodeFile="ProductVariantAttributeValues.aspx.cs" ValidateRequest="false" Inherits="Tathata.Web.Administration.Administration_ProductVariantAttributeValues" %>

<%@ Register TagPrefix="nopCommerce" TagName="SimpleTextBox" Src="Modules/SimpleTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="NumericTextBox" Src="Modules/NumericTextBox.ascx" %>
<%@ Register TagPrefix="nopCommerce" TagName="DecimalTextBox" Src="Modules/DecimalTextBox.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="c1" ContentPlaceHolderID="cph1" runat="Server">
    <div>
        <table class="adminContent">
            <tr>
                <td class="adminData">
                    <asp:Label ID="lblTitle" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
        <table class="adminContent">
            <tr>
                <td colspan="2" width="100%">
                    <asp:GridView ID="gvProductVariantAttributeValues" runat="server" AutoGenerateColumns="false"
                        DataKeyNames="ProductVariantAttributeValueID" OnRowDeleting="gvProductVariantAttributeValues_RowDeleting"
                        OnRowDataBound="gvProductVariantAttributeValues_RowDataBound" OnRowCommand="gvProductVariantAttributeValues_RowCommand"
                        Width="100%">
                        <Columns>
                            <asp:TemplateField HeaderText="Name" ItemStyle-Width="40%">
                                <ItemTemplate>
                                    <asp:HiddenField ID="hfProductVariantAttributeValueID" runat="server" Value='<%# Eval("ProductVariantAttributeValueID") %>' />
                                    <nopCommerce:SimpleTextBox runat="server" CssClass="adminInput" ID="txtName" ValidationGroup="ProductVariantAttributeValue"
                                        ErrorMessage="Name is required" Text='<%# Eval("Name") %>'></nopCommerce:SimpleTextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Price Adjustment" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" Width="50px" Value='<%# Eval("PriceAdjustment") %>'
                                        ID="txtPriceAdjustment" RequiredErrorMessage="Price adjustment is required" MinimumValue="0" MaximumValue="999999"
                                        ValidationGroup="ProductVariantAttributeValue" RangeErrorMessage="The value must be from 0 to 999999">
                                    </nopCommerce:DecimalTextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Display order" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" Width="50px" ID="txtDisplayOrder"
                                        Value='<%# Eval("DisplayOrder") %>' RequiredErrorMessage="Display order is required"
                                        RangeErrorMessage="The value must be from -99999 to 99999" ValidationGroup="ProductVariantAttributeValue"
                                        MinimumValue="-99999" MaximumValue="99999"></nopCommerce:NumericTextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Update" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
                                ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Button ID="btnUpdate" runat="server" CssClass="adminButton" Text="Update" ValidationGroup="ProductVariantAttributeValue"
                                        CommandName="UpdateProductVariantAttributeValue" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="15%"
                                ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Button ID="btnDeleteProductVariantAttribute" runat="server" CssClass="adminButton"
                                        Text="Delete" CausesValidation="false" CommandName="Delete" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                </td>
            </tr>
        </table>
        <table class="adminContent">
            <tr>
                <td colspan="2">
                    <b>Adding new values</b>
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    Name:
                </td>
                <td class="adminData">
                    <nopCommerce:SimpleTextBox runat="server" CssClass="adminInput" ID="txtNewName" ValidationGroup="NewProductVariantAttributeValue"
                        ErrorMessage="Name is required"></nopCommerce:SimpleTextBox>
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    Price Adjustment [<%=CurrencyManager.PrimaryStoreCurrency.CurrencyCode%>]:
                </td>
                <td class="adminData">
                    <nopCommerce:DecimalTextBox runat="server" CssClass="adminInput" ID="txtNewPriceAdjustment"
                        Value="0" RequiredErrorMessage="Price adjustment is required" MinimumValue="0"
                        MaximumValue="999999" RangeErrorMessage="The value must be from 0 to 999999"
                        ValidationGroup="NewProductVariantAttributeValue"></nopCommerce:DecimalTextBox>
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    Display order:
                </td>
                <td class="adminData">
                    <nopCommerce:NumericTextBox runat="server" CssClass="adminInput" ID="txtNewDisplayOrder"
                        Value="1" RequiredErrorMessage="Display order is required" RangeErrorMessage="The value must be from -99999 to 99999"
                        MinimumValue="-99999" MaximumValue="99999" ValidationGroup="NewProductVariantAttributeValue">
                    </nopCommerce:NumericTextBox>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="left">
                    <asp:Button runat="server" ID="btnAdd" CssClass="adminButton" Text="Add" ValidationGroup="NewProductVariantAttributeValue"
                        OnClick="btnAdd_Click"></asp:Button>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
